package com.bwie.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户表
 * @TableName tb_user
 */
@TableName(value ="tb_user")
@Data
public class TbUser implements Serializable {
    /**
     * 用户ID
     */
    @TableId(type = IdType.AUTO)
    private Integer userId;

    /**
     * 登录账号
     */
    @NotBlank(message = "姓名不能为空")
    @Size(min = 5,max = 16,message = "账号必须要五到十六位数")
    private String userName;

    /**
     * 登录密码
     */
    @Pattern(regexp = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{6,}$",message = "必须包含大小写字母和数字的组合至少6位")
    @NotBlank(message = "密码不能为空")
    private String userPass;

    /**
     * 真实姓名
     */
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{0,}$",message = "姓名必须包含汉字")
    @NotBlank(message = "真实姓名不能为空")
    private String nickName;

    /**
     * 手机号
     */
    @Pattern(regexp = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$",message = "手机号格式不正确")
    @NotBlank(message = "手机号不能为空")
    private String userMobile;

    /**
     * 邮箱
     */
    @Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$",message = "邮箱格式正确")
    @NotBlank(message = "邮箱不能为空")
    private String userEmail;

    /**
     * 头像
     */
    private String userAvatar;

    /**
     * 审核状态
     */
    private Integer userStatus;

    /**
     * 审核原因
     */
    private String reason;

    /**
     * 注册时间
     */
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private String token;
}